// 引入依赖包
import koa from 'koa'
import { appPort } from './config/appSetting.js'
import { route } from './controllers/index.js'
import { sync } from './db/index.js'
import './model/Blog.js'

// 连接数据库
// await sync()

// 实例化
let app = new koa()

// 中间件
app.use(async (ctx, next) => {
  await next()
})

// 注册路由
route(app)

// 监听
app.listen(appPort)
console.log(`此项目运行在如下地址：http://localhost:${appPort}`);
